web3.js@0.2x.x web3.toWei
web3.toWei(number, unit)
以下の Ethereum の単位から、wei に変換します。
kwei/ada
mwei/babbage
gwei/shannon
szabo
finney
ether
kether/grand/einstein
mether
gether
tether
パラメータ
1. Number|String|BigNumber
数値または数値を表す文字列
2. String
上記の単位のいずれか
戻り値
String|BigNumber
数値を表す文字列または BigNumber のインスタンスを返します。
返される値はパラメータに依存します。
サンプルコード
code:example.js
var value = web3.toWei('1', 'ether');
console.log(value); // "1000000000000000000"
参考